﻿namespace OneDark.Update
{
    public class ConfigRdr
    {
        private IniFile iniFile;
        private readonly string strCfgPath = "Config/config.ini";

        public static int MaxUpdateThreads = 5;

        public static bool UseCnpmjs = false;

        public static string CnpmjsGithubUrl;

        public void Load()
        {
            iniFile = new IniFile(strCfgPath);
            MaxUpdateThreads = iniFile.GetInt32("GitConfig", "MaxUpdateThreads", MaxUpdateThreads);
            int useCnpmjs = iniFile.GetInt32("cnpmjs", "Usecnpmjs", 1);
            UseCnpmjs = useCnpmjs == 1;

            CnpmjsGithubUrl = iniFile.GetString("cnpmjs", "Url", "");

        }

        public void Save()
        {
            iniFile.WriteValue("GitConfig", "MaxUpdateThreads", MaxUpdateThreads);
        }
    }
}